package com.example.appxi;



import com.example.appxi.BannerActivity.PlaceholderFragment;
import com.example.appxi.BannerActivity.SectionsPagerAdapter;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.view.View.OnClickListener;

public class PopupMe extends Activity {
	
	View btn_favorplace;
	View btn_myfriend;
	
	static Context mContext;
	
	TextView text_favorplace;
	TextView text_myfriend;

	
	SectionsPagerAdapter mSectionsPagerAdapter;
	ViewPager mViewPager;
	
    @SuppressLint("NewApi")
	@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_me);
        DisplayMetrics metrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(metrics);
        int SWidth=metrics.widthPixels;
        int SHeight=metrics.heightPixels;
        int Width = (int)(SWidth*0.9);
        int Height = (int)(SHeight*0.9);
        
        View v  = findViewById(R.id.popup);
        View vx = findViewById(R.id.popupx);
        
        ViewGroup.LayoutParams params = v.getLayoutParams();
        params.width = Width;
        params.height = Height;
        v.setLayoutParams(params);
        
        ViewGroup.LayoutParams paramsx = vx.getLayoutParams();
        paramsx.width = SWidth;
        paramsx.height = SHeight;
        vx.setLayoutParams(paramsx);
               
        
//        ViewGroup.LayoutParams params_r = vr.getLayoutParams();
//        params_r.width = 50;
//        params_r.height = 50;
//        vr.setLayoutParams(params_r);
//        
        
        Button btn_close = (Button) findViewById(R.id.bt_close);
        btn_close.setOnClickListener(new OnClickListener(){
        	@Override
        	public void onClick(View v) {
    		finish();
        	}
        });
        
        
//        
//        mContext = getApplicationContext();
//        
//        btn_favorplace=findViewById(R.id.bt_favorplace);
//        btn_myfriend=findViewById(R.id.bt_myfriend);
//        text_favorplace=(TextView) findViewById(R.id.T_favorplace);
//        text_myfriend=(TextView) findViewById(R.id.T_myfriend);
//
//        
//    	mSectionsPagerAdapter = new SectionsPagerAdapter(
//     			getSupportFragmentManager());
//  
//    		mViewPager = (ViewPager) findViewById(R.id.mepager);
//    		mViewPager.setAdapter(mSectionsPagerAdapter);
//    		mViewPager
//			.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
//				@Override
//				public void onPageSelected(int position) {
//					TabControll(position);
//				}
//			});
//
//        TabControll(0);
//        
//        btn_favorplace.setOnClickListener(new OnClickListener()
//        {
//
//			@Override
//			public void onClick(View v) {
//				// TODO Auto-generated method stub
//				mViewPager.setCurrentItem(0, true);
//			}
//        	
//        });
//        btn_myfriend.setOnClickListener(new OnClickListener()
//        {
//
//			@Override
//			public void onClick(View v) {
//				// TODO Auto-generated method stub
//				mViewPager.setCurrentItem(1, true);
//			}
//        	
//        });
    }
        
       

	@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        
        // Inflate the menu; this adds items to the action bar if it is present.
        //getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
    
//    public void TabControll(int position)
//    {
//    	String strColorOn = "#FF0000";
//    	String strColorOff = "#000000";
//    	switch(position)
//    	{
//    	case 0:
//    		text_favorplace.setTextColor(Color.parseColor(strColorOn));
//    		text_myfriend.setTextColor(Color.parseColor(strColorOff));
//    		break;
//    	case 1:
//    		text_favorplace.setTextColor(Color.parseColor(strColorOff));
//    		text_myfriend.setTextColor(Color.parseColor(strColorOn));
//    		break;
//
//    	}
// 
//    }
//    

    
//    public class SectionsPagerAdapter extends FragmentPagerAdapter {
//
//		public SectionsPagerAdapter(FragmentManager fm) {
//			super(fm);
//		}
//
//		@Override
//		public Fragment getItem(int position) {
//			// getItem is called to instantiate the fragment for the given page.
//			// Return a PlaceholderFragment (defined as a static inner class
//			// below).
//			return PlaceholderFragment.newInstance(position + 1);
//		}
//
//		@Override
//		public int getCount() {
//			// Show 3 total pages.
//			return 2;
//		}
//
//
//	}
    
//    public static class PlaceholderFragment extends Fragment {
//
//		private static final String ARG_SECTION_NUMBER = "section_number";
//
//		public static PlaceholderFragment newInstance(int sectionNumber) {
//			PlaceholderFragment fragment = new PlaceholderFragment();
//			Bundle args = new Bundle();
//			args.putInt(ARG_SECTION_NUMBER, sectionNumber);
//			fragment.setArguments(args);
//			return fragment;
//		}
//
//		public PlaceholderFragment() {
//		}
//
//		@Override
//		public View onCreateView(LayoutInflater inflater, ViewGroup container,
//				Bundle savedInstanceState) {
//			View rootView = inflater.inflate(R.layout.frag_me, container,
//					false);
//			
//
//			return rootView;
//		}
//	}

    
    @Override
    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first)
    {
    	super.onApplyThemeResource(theme, resid, first);
    	theme.applyStyle(android.R.style.Theme_Panel, true);
    }

}
